from kivy.uix.floatlayout import FloatLayout

from amgineirc.view.channels.logView import LogView
from amgineirc.view.messageView import MessageView
from amgineirc.view.channels.sendView import SendView
from amgineirc.viewModel.channels.dccViewModel import DccViewModel

"""
top = log view
bottom = send view
"""
class DccView(FloatLayout, MessageView):
    def __init__(self,
                 connection,
                 nick,
                 trusted_user_record,
                 appdata):
        FloatLayout.__init__(self, size_hint=(1.0, 1.0))
        MessageView.__init__(self)
        # the recieve view - top
        self.receive_view = LogView(size_hint=(1.0, 0.9),
                                    pos_hint={'x':0.0, 'y':0.1},
                                    maximum_log_count=20)
        self.add_widget(self.receive_view)
        # the send view - bottom
        self.send_view = SendView(size_hint=(1.0, 0.1),
                                  pos_hint={'x':0.0, 'y':0.0})
        self.add_widget(self.send_view)
        # initialize the view model
        self.view_model = DccViewModel(self,
                                       self.send_view,
                                       self.receive_view,
                                       connection,
                                       nick,
                                       trusted_user_record,
                                       appdata)

    def vm_set_state(self, **kargs):
        if 'connected' in kargs:
            # ignore
            pass
